//		ID : Xerxes
//      "I have not failed, I have just found 10000 ways that won't work.
//


#include <iostream>
#include <algorithm>
#include <vector>
#include <sstream>
#include <fstream>
#include <string>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <functional>
#include <bitset>

#include <ctime>
#include <cassert>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <climits>
#include <cstring>
#include <cstdlib>

using namespace std;

#define VI vector< int >
#define CI( x ) scanf("%d",&x)
#define CL( x ) scanf("%lld",&x)
#define CD( x ) scanf("%lf",&x )
#define fo(i,st,ed) for(int i = st ; i < ed ; ++i )
#define foE(i,st,ed) for(int i = st ; i <= ed ; ++i )
#define foit(i, x) for (typeof((x).begin()) i = (x).begin(); i != (x).end(); i++)
#define bip system("pause")
#define Int long long
#define pb push_back
#define SZ(X) (int)(X).size()
#define LN(X) (int)(X).length()
#define mk make_pair
#define f first
#define s second
#define SET( ARRAY , VALUE ) memset( ARRAY , VALUE , sizeof(ARRAY) )

inline void wait( double seconds ){
    double endtime = clock()+( seconds* CLOCKS_PER_SEC );
    while( clock() < endtime ){
        ;
    }
}

const int inf = (int)700;
int root[ inf+10 ];
int rank[ inf+10 ];
inline void _Set(){
    fo(i,0,inf){
        root[i]=i;
        rank[i]=0;
    }
}
inline int _Find(int x){
    if( x!= root[x] ){
        root[x] = _Find(root[x]);
    }
return root[x];
}
inline void _Union(int x, int y){
    int rx = _Find(x);
    int ry = _Find(y);

    if( rank[rx] > rank[ry] ){
        root[ry] = rx;
    }
    else{
        root[rx] = ry;
    }
    if( rank[rx]==rank[ry] ){
        rank[ry]+=1;
    }
}

int s;
int n;
int k;
struct NODE{
    int x,y;
    double cc;
    NODE(int a, int b, double c):
    x(a),y(b),cc(c){;}
};
vector< NODE > edges;
vector< pair<int,int> > vt;
inline void Read(){
	CI(s);
	CI(n);
    vt.assign(n, mk(0,0) );
    fo(i,0,n){
        CI(vt[i].f);
        CI(vt[i].s);
    }
}
inline bool cmp(NODE A, NODE B){
    return A.cc < B.cc ;
}

inline void mst(){
    _Set();
    sort(edges.begin(), edges.end(), cmp);
    // jeta sob theke boro oeta bad dibo net work er
    // and connected edge k!= n-s porjonto connect korle e hobe
    
    double max_dist=0;
    double found=true;
    for(int i=0,j=SZ(edges), k=0 ; i<j && k!=( n-s) ; ++i ){
        int x = edges[i].x;
        int y = edges[i].y;
        double dd = edges[i].cc;

        if( _Find(x)!=_Find(y) ){
            _Union(x,y);
            ++k;
            if( found ){
				max_dist = dd;
				found=false;
			}
			else{
				max_dist = max( max_dist, dd );
			}
        }
    }
    
    printf("%.2lf\n",max_dist);
}
inline void Proc(){
    edges.clear();
    fo(i,0,n){
        fo(j,i+1,n){
            double dist = sqrt( (double)( (vt[i].f-vt[j].f)*(vt[i].f-vt[j].f) + (vt[i].s-vt[j].s)*(vt[i].s-vt[j].s) ) ) ;
            edges.pb( NODE(i,j, dist) );
        }
    }
    mst();
}
int main(){
    #ifndef ONLINE_JUDGE
        freopen("in","rt",stdin);
    #endif
    
    CI(k);
    while(k--){
		Read();
		Proc();
	}

return 0;
}
